package main

import (
	"fmt"
	"reflect"
)

func main() {
	results := returnVarTest()
	if results == nil {
		fmt.Println("returned nil")
	}
	fmt.Println(len(results))
}

// 了解关于 空切片以及nil切片更多内容,可以参考
// https://juejin.im/post/5bea58df6fb9a049f153bca8
func returnVarTest() (results []int) {
	if results == nil {
		fmt.Println("results is nil")
	}

	types := reflect.TypeOf(results)
	fmt.Println(types)
	var ret []int
	if ret == nil {
		fmt.Println("ret is nil")
	}
	ret2 := make([]int, 0)
	if ret2 == nil {
		fmt.Println("ret2 is nil")
	}
	return
}

func test1() {
	array := [65][2]int{
		{0, 0},
		{0, 1},
		{0, 2},
		{0, 3},
		{0, 4},
	}
	fmt.Printf("array address = %p\n", &array)

	for i, _ := range array {
		fmt.Printf("element address = %p, element val = %v\n", &array[i], array[i])
	}
}
